home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / MakeTAGS < prev    next >
Text File  |  1993-05-12  |  3KB  |  100 lines

  1. # Make the TAGS files.
  2.  
  3. # Copyright (C) 1992 Free Software Foundation, Inc.
  4. # This file is part of the GNU C Library.
  5.  
  6. # The GNU C Library is free software; you can redistribute it and/or
  7. # modify it under the terms of the GNU Library General Public License
  8. # as published by the Free Software Foundation; either version 2 of
  9. # the License, or (at your option) any later version.
  10.  
  11. # The GNU C Library is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  14. # Library General Public License for more details.
  15.  
  16. # You should have received a copy of the GNU Library General Public
  17. # License along with the GNU C Library; see the file COPYING.LIB.  If
  18. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  19. # Cambridge, MA 02139, USA.
  20.  
  21. ifdef subdir
  22. .. := ../
  23. endif
  24.  
  25. include $(..)Makeconfig
  26.  
  27. ifndef tags_sources
  28. ifeq ($(subdir),ctype)
  29. # In most cases, we want the C source files to come before
  30. # the header files so tags for optimizing #define's in the
  31. # headers won't be put in the tags files, but for ctype,
  32. # the functions are just backup for the #define's in the header.
  33. tags_sources = $(all-headers) $(all-sources)
  34. else    # Not ctype.
  35. tags_sources = $(all-sources) $(all-headers)
  36. endif    # ctype
  37. endif    # No tags_sources
  38.  
  39. sysdep-dirs := $(addprefix $(sysdep_dir)/,$(sysdirs))
  40.  
  41. # Find all sysdep dirs there are, but putting the ones
  42. # we are configured to use first and preserving their order.
  43. all-dirs := $(objdir) \
  44.         $(sysdep-dirs) \
  45.         $(source_dirs) \
  46.         $(filter-out $(sysdep-dirs),\
  47.              $(patsubst ./%,%,\
  48.                     $(shell find $(sysdep_dir) -type d -print)\
  49.               ))
  50.  
  51. # Find all the subdirs there are, but putting the ones
  52. # we are configured to use first and preserving their order.
  53. ifndef subdir
  54. subdirs := $(subdirs) \
  55.        $(filter-out $(subdirs),\
  56.             $(shell cat $(wildcard $(addsuffix /Subdirs,\
  57.                                $(all-dirs)))\
  58.                     /dev/null))
  59. all-dist = $(shell cat /dev/null $(wildcard $(filter %.c %.h %.S %.s,\
  60.                              $(all-dirs:%=%/Dist))))
  61. tags_sources = $(all-sources) $(all-headers) $(all-dist)
  62. endif
  63.  
  64. # All different versions of $(sources), preserving the configured sysdep
  65. # directory order.
  66. all-sources = $(wildcard $(foreach file,$(sources),\
  67.                    $(file) \
  68.                    $(foreach dir,$(all-dirs),\
  69.                          $(dir)/$(file) \
  70.                          $(dir)/$(file:.c=.S) \
  71.                          $(dir)/$(file:.c=.s))))
  72.  
  73. all-headers = $(wildcard $(foreach file,$(headers),\
  74.                    $(file) \
  75.                    $(foreach dir,$(all-dirs),$(dir)/$(file))))
  76.  
  77. tags_sources := $(strip $(tags_sources))
  78.  
  79. TAGS: $(tags_sources)
  80. ifdef subdir
  81. ifdef tags_sources
  82.     $(ETAGS) -o $@ $^
  83. else
  84. # No sources.  Create a dummy file. 
  85.     touch $@
  86. endif # tags_sources
  87. else # parent
  88. TAGS: subdir_TAGS
  89. # Note that this uses the -i switch, and thus requires v19 etags.
  90.     $(ETAGS) -o $@ \
  91.          $(subdirs:%=-i %/TAGS) \
  92.          $(filter-out subdir_TAGS,$^)
  93.  
  94. .PHONY: subdir_TAGS $(subdirs:%=%/TAGS)
  95. subdir_TAGS: $(subdirs:%=%/TAGS)
  96. $(subdirs:%=%/TAGS):
  97.     $(MAKE) -C $(@D) no_deps=t $(@F)
  98.  
  99. endif # subdir
  100.